home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 August: Tool Chest / Dev.CD Aug 95 TC / Dev.CD Aug 95 TC.toast / Tool Chest / Interfaces / UniversalInterfaces 2.1B1 / CIncludes / ADSPSecure.h next >
Encoding:
C/C++ Source or Header  |  1995-04-18  |  6.5 KB  |  220 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        ADSPSecure.h
  3.  
  4.      Contains:    Secure AppleTalk Data Stream Protocol Interfaces.
  5.  
  6.      Version:    Technology:    AOCE Toolbox 1.02
  7.                  Package:    Universal Interfaces 2.1ß1 in “MPW Prerelease” on ETO #17
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __ADSPSECURE__
  21. #define __ADSPSECURE__
  22.  
  23.  
  24. #ifndef __EVENTS__
  25. #include <Events.h>
  26. #endif
  27. /*    #include <Types.h>                                            */
  28. /*        #include <ConditionalMacros.h>                            */
  29. /*    #include <Quickdraw.h>                                        */
  30. /*        #include <MixedMode.h>                                    */
  31. /*        #include <QuickdrawText.h>                                */
  32. /*    #include <OSUtils.h>                                        */
  33. /*        #include <Memory.h>                                        */
  34.  
  35. #ifndef __NOTIFICATION__
  36. #include <Notification.h>
  37. #endif
  38.  
  39. #ifndef __APPLEEVENTS__
  40. #include <AppleEvents.h>
  41. #endif
  42. /*    #include <Errors.h>                                            */
  43. /*    #include <EPPC.h>                                            */
  44. /*        #include <AppleTalk.h>                                    */
  45. /*        #include <Files.h>                                        */
  46. /*        #include <PPCToolbox.h>                                    */
  47. /*        #include <Processes.h>                                    */
  48.  
  49. #ifndef __TYPES__
  50. #include <Types.h>
  51. #endif
  52.  
  53. #ifndef __ADSP__
  54. #include <ADSP.h>
  55. #endif
  56.  
  57. #ifndef __FILES__
  58. #include <Files.h>
  59. #endif
  60.  
  61. #ifndef __OCE__
  62. #include <OCE.h>
  63. #endif
  64. /*    #include <Aliases.h>                                        */
  65. /*    #include <Script.h>                                            */
  66. /*        #include <IntlResources.h>                                */
  67.  
  68. #ifndef __OCEAUTHDIR__
  69. #include <OCEAuthDir.h>
  70. #endif
  71.  
  72. #ifdef __cplusplus
  73. extern "C" {
  74. #endif
  75.  
  76. #if PRAGMA_ALIGN_SUPPORTED
  77. #pragma options align=mac68k
  78. #endif
  79.  
  80. #if PRAGMA_IMPORT_SUPPORTED
  81. #pragma import on
  82. #endif
  83.  
  84.  
  85. enum {
  86.     sdspOpen                    = 229
  87. };
  88.  
  89. /*
  90. For secure connections, the eom field of ioParams contains two single-bit flags
  91. (instead of a zero/non-zero byte). They are an encrypt flag (see below), and an
  92. eom flag.  All other bits in that field should be zero.
  93.  
  94. To write an encrypted message, you must set an encrypt bit in the eom field of
  95. the ioParams of your write call. Note: this flag is only checked on the first
  96. write of a message (the first write on a connection, or the first write following
  97. a write with eom set.
  98. */
  99. enum {
  100.     dspEOMBit,                                                    /* set if EOM at end of write */
  101.     dspEncryptBit                                                /* set to encrypt message */
  102. };
  103.  
  104. enum {
  105.     dspEOMMask                    = 1 << dspEOMBit,
  106.     dspEncryptMask                = 1 << dspEncryptBit
  107. };
  108.  
  109. enum {
  110.     sdspWorkSize                = 2048
  111. };
  112.  
  113. struct TRSecureParams {
  114.     unsigned short                    localCID;                    /* local connection id */
  115.     unsigned short                    remoteCID;                    /* remote connection id */
  116.     AddrBlock                        remoteAddress;                /* address of remote end */
  117.     AddrBlock                        filterAddress;                /* address filter */
  118.     unsigned long                    sendSeq;                    /* local send sequence number */
  119.     unsigned short                    sendWindow;                    /* send window size */
  120.     unsigned long                    recvSeq;                    /* receive sequence number */
  121.     unsigned long                    attnSendSeq;                /* attention send sequence number */
  122.     unsigned long                    attnRecvSeq;                /* attention receive sequence number */
  123.     unsigned char                    ocMode;                        /* open connection mode */
  124.     unsigned char                    ocInterval;                    /* open connection request retry interval */
  125.     unsigned char                    ocMaximum;                    /* open connection request retry maximum */
  126.     Boolean                            secure;                        /*  --> TRUE if session was authenticated */
  127.     AuthKeyPtr                        sessionKey;                    /* <--> encryption key for session */
  128.     unsigned long                    credentialsSize;            /*  --> length of credentials */
  129.     Ptr                                credentials;                /*  --> pointer to credentials */
  130.     Ptr                                workspace;                    /*  --> pointer to workspace for connection
  131.                                            align on even boundary and length = sdspWorkSize */
  132.     AuthIdentity                    recipient;                    /*  --> identity of recipient (or initiator if active mode */
  133.     UTCTime                            issueTime;                    /*  --> when credentials were issued */
  134.     UTCTime                            expiry;                        /*  --> when credentials expiry */
  135.     RecordIDPtr                        initiator;                    /* <--  RecordID of initiator returned here.
  136.                                             Must give appropriate Buffer to hold RecordID
  137.                                             (Only for passive or accept mode) */
  138.     Boolean                            hasIntermediary;            /* <--  will be set if credentials has an intermediary */
  139.     Boolean                            filler1;
  140.     RecordIDPtr                        intermediary;                /* <--  RecordID of intermediary returned here.
  141.                                             (If intermediary is found in credentials
  142.                                             Must give appropriate Buffer to hold RecordID
  143.                                             (Only for passive or accept mode) */
  144. };
  145. typedef struct TRSecureParams TRSecureParams;
  146.  
  147. typedef struct SDSPParamBlock SDSPParamBlock;
  148.  
  149. typedef SDSPParamBlock *SDSPPBPtr;
  150.  
  151. typedef pascal void (*SDSPIOCompletionProcPtr)(SDSPPBPtr paramBlock);
  152.  
  153. #if GENERATINGCFM
  154. typedef UniversalProcPtr SDSPIOCompletionUPP;
  155. #else
  156. typedef SDSPIOCompletionProcPtr SDSPIOCompletionUPP;
  157. #endif
  158.  
  159. enum {
  160.     uppSDSPIOCompletionProcInfo = kPascalStackBased
  161.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(SDSPPBPtr)))
  162. };
  163.  
  164. #if GENERATINGCFM
  165. #define NewSDSPIOCompletionProc(userRoutine)        \
  166.         (SDSPIOCompletionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppSDSPIOCompletionProcInfo, GetCurrentArchitecture())
  167. #else
  168. #define NewSDSPIOCompletionProc(userRoutine)        \
  169.         ((SDSPIOCompletionUPP) (userRoutine))
  170. #endif
  171.  
  172. #if GENERATINGCFM
  173. #define CallSDSPIOCompletionProc(userRoutine, paramBlock)        \
  174.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppSDSPIOCompletionProcInfo, (paramBlock))
  175. #else
  176. #define CallSDSPIOCompletionProc(userRoutine, paramBlock)        \
  177.         (*(userRoutine))((paramBlock))
  178. #endif
  179.  
  180. struct SDSPParamBlock {
  181.     struct QElem                    *qLink;
  182.     short                            qType;
  183.     short                            ioTrap;
  184.     Ptr                                ioCmdAddr;
  185.     SDSPIOCompletionUPP                ioCompletion;
  186.     OSErr                            ioResult;
  187.     char                            *ioNamePtr;
  188.     short                            ioVRefNum;
  189.     short                            ioCRefNum;                    /* adsp driver refNum */
  190.     short                            csCode;                        /* adsp driver control code */
  191.     long                            qStatus;                    /* adsp internal use */
  192.     short                            ccbRefNum;                    /* connection end refNum */
  193.     union {
  194.         TRinitParams                    initParams;                /* dspInit, dspCLInit */
  195.         TRopenParams                    openParams;                /* dspOpen, dspCLListen, dspCLDeny */
  196.         TRcloseParams                    closeParams;            /* dspClose, dspRemove */
  197.         TRioParams                        ioParams;                /* dspRead, dspWrite */
  198.         TRattnParams                    attnParams;                /* dspAttention */
  199.         TRstatusParams                    statusParams;            /* dspStatus */
  200.         TRoptionParams                    optionParams;            /* dspOptions */
  201.         TRnewcidParams                    newCIDParams;            /* dspNewCID */
  202.         TRSecureParams                    secureParams;            /* dspOpenSecure */
  203.     } u;
  204. };
  205.  
  206.  
  207. #if PRAGMA_IMPORT_SUPPORTED
  208. #pragma import off
  209. #endif
  210.  
  211. #if PRAGMA_ALIGN_SUPPORTED
  212. #pragma options align=reset
  213. #endif
  214.  
  215. #ifdef __cplusplus
  216. }
  217. #endif
  218.  
  219. #endif /* __ADSPSECURE__ */
  220.